<?php

class post_helper {

	static function ajax_post_deal( $D )
	{
		$arr=array();
		if( is_array($D) ) {
			foreach($D as $k=>$v)
			{
				$arr[$k]= iconv("GB18030", "UTF-8", $v );

			}
			return $arr;
		} else {
			return iconv("GB18030", "UTF-8", $D );
		}
	}

	static function gbk2utf( $D )
	{
		$arr=array();
		if( is_array($D) ) {
			foreach($D as $k=>$v)
			{
				$arr[$k]= iconv("GB18030",   "UTF-8", $v );

			}
			return $arr;
		} else {
			return iconv("GB18030",   "UTF-8", $D );
		}
	}


	/**
	 * 解析post数据
	 * 数据格式 "前缀-名称"
	 *
	 * @param unknown_type $post
	 */
	public function upDataExplain( $pre, $post )
	{

		$UP_data=array();

		foreach ($post as $k => $v)
		{
			$d = explode('-',$k);
			/**
			 * $d[0]:前缀
			 * $d[1]:字段名
			 */
			if( count($d)==2 && $d[0]==$pre)
			{
					/*		时间数据转换成int类型		*/
				$UP_data[$d[1]]=$v;
			}
		}
		return $UP_data;
	}

}
